<%@ page language="java"  pageEncoding="utf-8"%>
<%@ page import="java.util.Vector,com.ejoysoft.wlanyz.business.Latlng,com.ejoysoft.common.Constants,com.ejoysoft.common.exception.NoRightException" %>
<%@ include file="../include/jsp/head.jsp"%>
<%
if(!globa.userSession.hasRight("10005"))
      throw new NoRightException("用户不具备操作该功能模块的权限，请与系统管理员联系！");
%>

<%
    //初始化
    Latlng  latlng0=null;
    Latlng obj=new Latlng(globa);
    //查询条件
    String  strAcName=ParamUtil.getString(request,"strAcName","").trim();
    String strAcLocation = ParamUtil.getString(request,"strAcLocation","").trim();
	String checked1 =  ParamUtil.getString(request,"checkedFlag","all"); 
	String tWhere=" WHERE 1=1";
	int tabi = 1;
	if(!strAcName.equals("")){
	 tWhere += " and acName in (select strid from ac_class_associate where classtwoac LIKE '%"+strAcName+"%')";
	 }
	if(!strAcLocation.equals("")){
	 tWhere += " and acLocation LIKE '%" + strAcLocation + "%'";
	}	
	if(checked1.equals("checked")){
	  tWhere += " and checkedLocation is not null and checkedLocation <>' ' ";
	  tabi = 2;
	}
	else if(checked1.equals("unchecked")){
	  tWhere += " and checkedLocation is null or checkedLocation =' '";
	  tabi = 3;
	}
	else{
	  tabi = 1;
	}
	 tWhere += " ORDER BY acName";
	//记录总数
	int intAllCount=obj.getCount(tWhere);	
	//当前页
	int intCurPage=globa.getIntCurPage();
	 
	//每页记录数
	String strPageSize = ParamUtil.getString(request,"strPageSize","10");
    int intPageSize;
    if(strPageSize.equals("所有"))intPageSize = intAllCount;
      else  intPageSize = Integer.parseInt(strPageSize);
	//共有页数
 	int intPageCount=(intAllCount-1)/intPageSize+1;
	// 循环显示一页内的记录 开始序号
	int intStartNum=(intCurPage-1)*intPageSize+1;
	//结束序号
	int intEndNum=intCurPage*intPageSize;   
	//获取到当前页面的记录集

System.out.println(tWhere);
	Vector<Latlng> vctObj=obj.list(tWhere,intStartNum,intPageSize);
	//获取当前页的记录条数
	int intVct=(vctObj!=null&&vctObj.size()>0?vctObj.size():0);
%>
<%try{
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="../css/main.css" rel="stylesheet" type="text/css" />
<style type="text/css">
 <!--
body {
	background-color: #f2f8ff;
}
.sel1{ width:160px;}
.STYLE1 {color: #FF0000}
.s6 a:link{ line-height:25px;height:25px; color:#333333}
.s6 a:hover{ line-height:25px;height:25px; color:#333333}
.tab1{ width:123px; height:27px; background:url(../images/tab_1.jpg); color:#a94602; text-align:center; line-height:25px; font-weight:bolder}
.tab2{ width:123px; height:27px; background:url(../images/tab_2.jpg); color:#666666; text-align:center;line-height:25px;line-height:26px;  border-right:1px solid #32a4ea; line-height:26px;}
-->
</style>
 <link href="../jquerytable/Styles/Site.css" rel="stylesheet" type="text/css" />
    <script src="../jquerytable/Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
    <script src="../jquerytable/Scripts/JQueryPlugin/TableSort.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            $("#tb").sorttable({
                ascImgUrl: "../jquerytable/Images/bullet_arrow_up.png",
                descImgUrl: "../jquerytable/Images/bullet_arrow_down.png",
                ascImgSize: "8px",
                descImgSize: "8px",
                sorttingMsg: "数据加载中...",
                sorttingMsgColor: "#FF6600",
                 maskOpacity: "0.6",
                 maskColor:"#D2F1FF",
                onSorted: function (cell) {
                  //  alert(cell.index() + " -- " + cell.text());
                }
            });
        });
    </script>
<script type="text/javascript">
 function showAc(){ 
  
  frm.action="latlng_list.jsp";
  // document.getElementById(<%=Constants.PAGE_SIZE_INDEX%>).value = "1"; //chrome浏览器不兼容。。
  frm.<%=com.ejoysoft.common.Constants.PAGE_SIZE_INDEX%>.value = "1";
  frm.submit();
 }
  function export_sbm(page){ 
  frm.action="latlng_export.jsp";
  document.getElementById("strCurPage").value = "<%=intCurPage%>";
  document.getElementById("exportContent").value = page;
  frm.submit();
 }
 
  function checks(){ 
  frm.action="latlng_optimization.jsp";
  frm.submit();
 }
 
 function checks1(flag){ 
  frm.action="latlng_list.jsp";
  if(flag ==0){
     document.getElementById("checkedFlag").value = "all";
  }
  else if(flag ==1){
     document.getElementById("checkedFlag").value = "checked";
  }
  else{
     document.getElementById("checkedFlag").value = "unchecked"; 
  }
  frm.submit();
 }
function clkOn(num){ 
	var allNum = 3;
	$("#tabLabel"+num).attr("class","tab1");
	for(i=1;i<=allNum;i++)
	{
		if(i != num)
		{
			$("#tabLabel"+i).attr("class","tab2");
		} 
	}
}
</script>

</head>


<body onload="clkOn(<%=tabi%>);">

<form id=frm name="frm" method=post action="latlng_list.jsp"> 
<input id="exportFlag" name="exportFlag" type="hidden" value="exportResult"/>
<input id="strCurPage" name="strCurPage" type="hidden" value="<%=intCurPage%>"/>
<input id="exportContent" name="exportContent" type="hidden" value=""/>
<input id="checkedFlag" name="checkedFlag" type="hidden" value="<%=checked1%>"/>
<table width="97%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="30"><img src="../images/ri_list.jpg" width="14" height="14" align="absbottom" />&nbsp;您现在所在的位置：<font color="#0e7cc9">资源配置</font> &gt; 经纬度核查</td>
  </tr>
</table>
<table width="97%" border="0" align="center" cellpadding="0" cellspacing="0">
  
  <tr>
    <td height="45" valign="middle" bgcolor="e1eef7">
      <table width="97%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
           <td width="31%" height="40" >热点(<span class="STYLE1">*</span>)
         <input id="strAcName" name="strAcName" type="text" style="width:70%;" value="<%=strAcName %>"  class="sell"/>
        </td>
        <td width="31%" >地址(<span class="STYLE1">*</span>)
          <input id="strAcLocation" name="strAcLocation" type="text" style="width:70%;" value="<%=strAcLocation %>"/></td>
        <td><img src="../images/search.jpg" onclick="showAc()" style="cursor:hand"/></td>
        </tr>
      </table></td>
  </tr>
</table>
<br/>
 <table width="97%" border="0" align="center" cellpadding="0" cellspacing="0">
 <tr>
 <td width="8%"  height="27" background="../images/tab_1.jpg" class="tab1" id="tabLabel1" onclick="clkOn('1');checks1(0)" style="cursor:hand">全部</td>
 <td width="8%"  background="../images/tab_2.jpg" class="tab2" id="tabLabel2"  onclick="clkOn('2');checks1(1) " style="cursor:hand">已核查</td>
 <td width="8%"  background="../images/tab_2.jpg" class="tab2" id="tabLabel3"  onclick="clkOn('3');checks1(2) " style="cursor:hand">未核查</td>
 <td background="../images/tab_2.jpg">&nbsp;</td>
    </tr>
 </table>
<table  id="tb" width="97%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr role="head">
    <td sort="true" width="10%" class="listtit">热点</td>
    <td sort="true" width="10%" class="listtit">地址</td>
    <td sort="true" width="14%" class="listtit">系统经纬度</td>
    <td sort="true" width="14%" class="listtit">手机定位经纬度</td>
    <td sort="true" width="14%" class="listtit">解析经纬度</td>
    <td sort="true" width="10%" class="listtit">准确度(米)</td>
    <td  width="15%" class="listtit">查看地图</td>
  </tr>
  <%
            for (int i = 0;i < vctObj.size(); i++) {
            	Latlng obj1 = vctObj.get(i);
            	String Olat = new String("") ;
                String Olng = new String("") ; 
                String Clat = new String("") ;
                String Clng = new String("") ;
                String Plat = new String("") ;
                String Plng = new String("") ;
                
            	if(obj1.getOriginalLocation()!=null){
	            	 String strOriginalLatlng[] = obj1.getOriginalLocation().trim().split(","); 
	            	 Olat = strOriginalLatlng[0];
	            	 Olng = strOriginalLatlng[1];
            	}
            	if(obj1.getPhoneLocation()!=null){
	            	 String strPhoneLatlng[] = obj1.getPhoneLocation().trim().split(","); 
	            	 Plat = strPhoneLatlng[0];
	            	 Plng = strPhoneLatlng[1];
            	}
            	if(obj1.getCheckedLocation()!=null){
            	     String strCheckedLatlng[] = obj1.getCheckedLocation().trim().split(",");
            	     Clat = strCheckedLatlng[0];
            	     Clng = strCheckedLatlng[1];
        
            %>
     

			       <tr>
              <td class="listd1"><%=(obj1.getAcName()==null?"未添加数据":obj1.getAcName()) %></td>
              <td class="listd1"><%=(obj1.getAcLocation()==null?"未添加数据":obj1.getAcLocation()) %></td>
              <td class="listd1">经度：<%=Olng%><br>纬度：<%=Olat %></td>
              <td class="listd1">经度：<%=Plng%><br>纬度：<%=Plat %></td>
              <td class="listd1">经度：<%=Clng%><br>纬度：<%=Clat %></td>
              <td class="listd1"><%= obj1.getDistance() %>&nbsp;</td>
              <td class="listd1"><input  type="button"   value="重新核查" class="ipt3"  onclick="window.open('show_map.jsp?viewFlag=check&random=<%=Math.random()%>&strId=<%=obj1.getStrId() %>','','')" style="cursor:hand"/><input  type="button"   value="查看" class="ipt3"  onclick="window.open('show_map.jsp?viewFlag=look&strId=<%=obj1.getStrId() %>','','')" style="cursor:hand"/></td>
			                                              
  </tr>
			 <%
			   }
			   else {
			  %>
			      <tr>
            <td class="listd1"><%=(obj1.getAcName()==null?"未添加数据":obj1.getAcName()) %></td>
            <td class="listd1"><%=(obj1.getAcLocation()==null?"未添加数据":obj1.getAcLocation()) %></td>
            <td class="listd1">经度：<%=Olng%><br>纬度：<%=Olat %></td>
            <td class="listd1">经度：<%=Plng%><br>纬度：<%=Plat %></td>
            <td class="listd1">经度：<%=Clng%><br>纬度：<%=Clat %></td>
            <td class="listd1"><%= obj1.getDistance() %>&nbsp;</td>
            <td class="listdrd"><img src="../images/check.png" /><a href="#"onclick="window.open('show_map.jsp?viewFlag=check&random=<%=Math.random()%>&strId=<%=obj1.getStrId() %>','','')" style="cursor:hand" >核查</a></td>
			                                              
  </tr>
			      <%
			       }//else
			       %>
			      
        <%
            }//for
         %> 
</table>

<table width="97%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="61%" height="50" valign="bottom"><!--<img src="../images1/pldel.jpg" width="83" height="27" align="absmiddle" style="cursor:hand"/>--> &nbsp;&nbsp;页面记录数

        <select name="strPageSize" id="strPageSize"  onchange="showAc()">
		<% 
		 String sltOpt[] = {"10","20","30","50","70","100","所有"};
		 for(int i=0; i < sltOpt.length;i++){
		 	String selected = "";
		    if(sltOpt[i].equals(strPageSize))
		      selected="selected='selected'";
		%>
		 <option value="<%=sltOpt[i] %>" <%=selected %>><%=sltOpt[i] %></option>
   		<%
   		 }
   		 %>  
   		 
      </select>  
    <img src="../images/dc.jpg" width="92" height="27" align="absmiddle" onclick="export_sbm('currentPage')" style="cursor:hand"/>
    <img src="../images/dcall.jpg" width="82" height="27" align="absmiddle" onclick="export_sbm('allPage')" style="cursor:hand"/>
    <img src="../images/yjhc.jpg" width="82" height="27" align="absmiddle" onclick="if(confirm('系统将在后台进行核查，请稍后查看结果！')){location.href='latlng_optimization.jsp';}"  style="cursor:hand"/>
    <input name="bt" class="ipt3" type="button" value="清空经纬度" onclick="if(confirm('确定清空经纬度！')){location.href='latlng_clear.jsp';}" /></td>
    <td></td>		
    <td width="39%" align="right" valign="bottom"><!--<table width="310" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="40"><img src="../images/up.jpg" width="40" height="30" /></td>
        <td width="221" align="center" background="../images/page_bg.jpg" class="page"><a href="#">1</a>&nbsp; <a href="#">2</a>&nbsp; <a href="#">3</a>&nbsp; <a href="#"><span class="sel">4</span></a>&nbsp; <a href="#">5</a> &nbsp;<a href="#">6</a> &nbsp;<a href="#">7</a>&nbsp; <a href="#">8 </a>&nbsp;<a href="#">9</a>&nbsp;...&nbsp;<a href="#">13</a> </td>
        <td width="39"><img src="../images/down.jpg" width="39" height="30" /></td>
      </tr>
    </table>--><!-- 翻页开始 -->  
     	<%@ include file="../include/jsp/cpage.jsp"%>
       	<!-- 翻页结束 --> </td>
  </tr>
 
</table>

</form>
</body>
</html>
<%}catch(Exception e){e.printStackTrace();} %>
<%@ include file="../include/jsp/footer.jsp"%>